// 登录页跳转到下一个页面的逻辑
function goToNextPage(page) {
    const pages = getCurrentPages();
    const { backUrl } = page.data;
    const targetUrl = `/${backUrl}`;
    const curPage = pages[pages.length - 1];
    const isLoginPage = /login|loginPhone/.test(curPage.route);
    if (pages.length > 1 && !isLoginPage) { // navigateTo跳转过来的, 会有页面堆栈
      wx.navigateBack();
    } else if (backUrl) { // 处理backUrl
      // tab跳转采用switchTab
      if (/(index\/index)|(customer\/customer)|(schedule\/schedule)|(my\/my)/.test(backUrl)) {
        wx.switchTab({
          url: targetUrl
        })
      } else {
        wx.reLaunch({
          url: targetUrl
        })
      }
    } else { // 保底跳转
        console.log("是这一份")
      wx.switchTab({
        url: '/pages/index/index'
      })
    }
}

export default goToNextPage